package com.general.framework.cc.thread;

public class T6 {
    public static void main(String[] args) {
        T6A t6A = new T6A();
        new Thread(()->{
            while (true){
                System.out.println("now in ==="+Thread.currentThread().getName()+", num ==="+t6A.genNum());
                try {
                    Thread.sleep(100);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }).start();
        new Thread(()->{
            while (true){
                System.out.println("now in ==="+Thread.currentThread().getName()+", num ==="+t6A.genNum());
                try {
                    Thread.sleep(100);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }).start();
    }
}


class T6A{
    private int num;
    public int genNum(){
        return num++;
    }
}